package com.zc.model.workflow.event;

import com.zc.common.MisConstants;
import com.zc.common.Operator;
import com.zc.common.StringUtil;
import com.zc.domain.single.${tableName!};

/**
 * ${comments!}
 *
 * @author 董晓峰
 * @datetime ${dqsj!}
 */
public class ${lcmc!}_EVEN extends WorkflowEvent {
    @Override
    public void endEven(String lcsl, String ywbh, Operator operator) throws Exception {
        super.endEven(lcsl, ywbh, operator);

        ${tableName!} ${className!} = new ${tableName!}();
        ${className!}.setId(ywbh);
        ${className!}.setShzt(MisConstants.BSDY_SHZT_SHTG);
        this.baseDao.mod(${className!});
    }

    @Override
    public void backEven(String lcslbh, String ryid, String ywbh, String hjbs, String ywzt, Operator operator) throws Exception {
        super.backEven(lcslbh, ryid, ywbh, hjbs, ywzt, operator);

        if (!StringUtil.isEmpty(ywzt)) {
            ${tableName!} ${className!} = new ${tableName!}();
            ${className!}.setId(ywbh);
            ${className!}.setShzt(Long.parseLong(ywzt));
            this.baseDao.mod(${className!});
        }
    }

    @Override
    public void recoverStartEven(String lcslid, String ywbh, Operator operator) throws Exception {
        super.recoverStartEven(lcslid, ywbh, operator);

        ${tableName!} ${className!} = new ${tableName!}();
        ${className!}.setId(ywbh);
        ${className!}.setShzt(MisConstants.BSDY_SHZT_SHZ);
        this.baseDao.mod(${className!});
    }

    public void delSlEven(String bzlc, String lcsl, String ywbh, Operator operator) throws Exception {
        super.delSlEven(bzlc, lcsl, ywbh, operator);

        ${tableName!} ${className!} = new ${tableName!}();
        ${className!}.setId(ywbh);
        ${className!}.setShzt(MisConstants.BSDY_SHZT_CGX);
        this.baseDao.mod(${className!});
    }
}
